<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('付款记录列表')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <p class="select-title"><b>[[${plan.planName}]]</b> 收款记录</p>
                <form id="formId">
                    <input type="hidden" name="planId" id="plan_id" th:value="${plan.id}">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>删除标志：</label>
                                <select name="deleteFlag" th:with="type=${@dict.getType('sys_normal_disable')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <input type="hidden" id="plan_id">
                <a class="btn btn-success" onclick="add()" shiro:hasPermission="erp:payable:payable:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
     <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('erp:payable:payable:edit')}]];
        var removeFlag = [[${@permission.hasPermi('erp:payable:payable:remove')}]];
        var approveStatusDatas = [[${@dict.getType('approve_status')}]];
        var deleteFlagDatas = [[${@dict.getType('sys_normal_disable')}]];
        var prefix = ctx + "erp/payable/payable";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add/{}",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: 'id',
                sortOrder: 'DESC',
                modalName: "付款记录",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'plan.planName',
                    title: '付款内容'
                },
                {
                    field: 'payTime',
                    title: '付款时间'
                },
                {
                    field: 'payAmount',
                    title: '付款金额'
                },
                {
                    field: 'bankAccount.name',
                    title: '银行账户'
                },
                {
                    field: 'approveStatus',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(approveStatusDatas, value);
                    }
                },
                {
                    field: 'description',
                    title: '备注'
                },
                {
                    field: 'deleteFlag',
                    title: '删除标志',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(deleteFlagDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function add()
        {
            $.modal.open('新增付款',prefix + '/add/' +$('#plan_id').val());
        }
    </script>
</body>
</html>